<template>
  <div id="header" style="width: 100%">
    <div class="m-header-box" align="center">
      <div class="m-header">
        <el-row>
          <el-col :span="12" align="left"
            ><img
              src="../assets/header/logo-head.png"
              alt="logo"
              style="height: 30px;margin: 15px 0 0 30px"
          /></el-col>
          <el-col :span="12" align="right">
            <div style="margin:0 40px 0 ">
              <el-dropdown transfer>
                <a
                  href="javascript:void(0)"
                  style="color: #FFF;font-size: 16px;height: 60px;line-height: 60px"
                >
                  <el-row>
                    <el-col :span="6">
                      <img
                        src="../assets/header/datou.png"
                        style="height: 30px;margin-top: 14px"
                      />
                    </el-col>
                    <el-col :span="18">
                      <p style="margin-left: 5px">{{ realName }}</p>
                    </el-col>
                  </el-row>
                </a>
                <el-dropdown-menu slot="dropdown" style="width: 120px">
                  <el-dropdown-item>
                    <button @click="logout()" class="logout">退出登录</button>
                  </el-dropdown-item>
                </el-dropdown-menu>
              </el-dropdown>
            </div>
          </el-col>
        </el-row>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Header1",
  data() {
    return {
      realName: ""
    };
  },
  mounted() {
    this.getRealName();
  },
  methods: {
    getRealName() {
      this.$store.dispatch("RealName");
      this.realName = this.$store.state.realName;
      if (this.realName === null) {
        this.$message.error("用户未登陆，请重新登陆");
        this.gotoLogin();
      }
    },
    gotoLogin() {
      this.$router.push({
        path: "/"
      });
    },
    logout() {
      this.$emit("logout", true);
    }
  }
};
</script>
<style>
.el-header {
  padding: 0;
}
.el-main {
  /*padding: 20px 0 0 20px;*/
  padding: 0;
}
.ivu-modal-content {
  border-radius: 20px;
  /*width: 550px;*/
  /*height: 657px;*/
}
.ivu-modal-header {
  background-color: #2992fd;
  height: 47px;
  color: #ffffff;
  border-radius: 18px 18px 0 0;
}
.el-tabs--border-card > .el-tabs__content {
  padding: 0;
}
.ivu-modal-header-inner {
  color: #ffffff;
}
.ivu-modal-body {
  padding: 0;
}
.el-radio__inner {
  width: 16px;
  height: 16px;
}
.el-radio__label {
  font-size: 16px;
}
.el-form-item {
  margin: 0;
}
.el-form-item__content {
}
.el-tabs--border-card > .el-tabs__header .el-tabs__item.is-active {
  border: none;
  background-color: #2992fd;
  color: #fff;
}
.el-tabs--border-card > .el-tabs__header .el-tabs__item.is-active:hover {
  color: #fff;
}
.el-tabs--border-card > .el-tabs__header .el-tabs__item {
  border: none;
  color: #fff;
  background-color: #81bbf7;
}
.el-tabs--border-card
  > .el-tabs__header
  .el-tabs__item:not(.is-disabled):hover {
  color: #fff;
}
.el-tabs--border-card {
  border: none;
}
.tabPane-confInfo > .ivu-tabs-card > .ivu-tabs-content {
  width: 436px;
  height: 720px;
  margin-top: -16px;
  margin-left: -6px;
}
</style>
<style scoped>
.m-header {
  width: 100vw;
  position: absolute;
  /*left: 50%;*/
  /*margin-left: -600px;*/
}
.m-header-box {
  width: 100%;
  position: relative;
  overflow: hidden;
  height: 64px;
}
.logout {
  margin-left: -20px;
  width: 118px;
  /*height: 20px;*/
  border: none;
  background-color: #ffffff;
}
</style>
